package ws;

import java.io.IOException;
import java.net.URI;

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONObject;

public class WebService {
	public static final String BASE_URL = "http://10.101.100.74:8080/TouchJoystickRest/touchcontroll";
private HttpClient httpClient;
	
	public WebService() {
		httpClient = new DefaultHttpClient();
	}
	public void executePut(String url, JSONObject jsonObject) {
		
		try {	
			HttpPut httpPut = new HttpPut(URI.create(url));
			httpPut.addHeader("content-type", "application/json");
			StringEntity entity = new StringEntity(jsonObject.toString());
			httpPut.setEntity(entity);
			HttpResponse response = httpClient.execute(httpPut);
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
